<template>
  <CheckboxGroup :options="myOptions" :disabled="display || disabled" />
</template>
<script setup lang="ts">
import { CheckboxGroup } from 'ant-design-vue'
import { computed, onMounted } from 'vue'
import { dicts, getDict } from '../../hooks/useDict'

const props = withDefaults(
  defineProps<{ options?: any[]; dict?: string; display?: boolean; disabled?: boolean }>(),
  {
    options: () => []
  }
)

onMounted(async () => {
  if (props.dict) {
    getDict(props.dict)
  }
})
const myOptions = computed(() => {
  if (props.dict) {
    return dicts[props.dict] || []
  }
  return props.options
})
</script>
<style module lang="scss"></style>
